package com.luych.toolbox.common.page;

import java.util.List;

public interface PageParam {

    /**
     * curr page num, from 1
     *
     * @return page num
     */
    long getPageNumber();

    /**
     * page size
     *
     * @return page size
     */
    long getPageSize();

    /**
     * sorts
     *
     * @return sorts
     */
    List<Sort> getSorts();

    /**
     * line start, from 0
     *
     * @return line start
     */
    default long getPageStart() {
        return getPageSize() * (getPageNumber() - 1);
    }

    /**
     * line ent
     *
     * @return line ent
     */
    default long getPageEnd() {
        return getPageSize() * getPageNumber() - 1;
    }

}
